package com.etoak.web.sys_menu_role.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etoak.web.sys_menu_role.entity.RoleMenu;
import com.etoak.web.sys_menu_role.entity.SaveMenuParm;
import com.etoak.web.sys_menu_role.mapper.SysMenRoleMapper;
import com.etoak.web.sys_menu_role.service.SysMenRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author by 孙有泽
 * @Date 2025/2/23 12:54
 * @Description
 */
@Service
public class SysMenRoleServiceImpl extends ServiceImpl<SysMenRoleMapper, RoleMenu> implements SysMenRoleService {

    @Override
    public void saveRoleMenu(SaveMenuParm parm) {
        QueryWrapper<RoleMenu> objectQueryWrapper = new QueryWrapper<>();
        objectQueryWrapper.eq("role_id",parm.getRoleId());
        this.remove(objectQueryWrapper);
       this.baseMapper.saveRoleMenu(parm.getRoleId(),parm.getMenuIds());
    }
}
